'''
* This is the projet for Brtc LlmOps Platform
* @Author Leon-liao <liaosiliang@alltman.com>
* @Description //TODO 
* @File: 4_str_output_paraser.py
* @Time: 2025/7/10
* @All Rights Reserve By Brtc
'''

import dotenv
from langchain_community.chat_models import ChatOpenAI
from langchain_core.output_parsers import StrOutputParser
from langchain_core.prompts import ChatPromptTemplate

dotenv.load_dotenv()
prompt = ChatPromptTemplate.from_template("{query}")
llm = ChatOpenAI(model="gpt-3.5-turbo-16k")
paraser = StrOutputParser()
content = paraser.invoke(llm.invoke(prompt.invoke({"query":"你好请讲一个关于程序员的冷笑话"})))
print(content)